package net.neptech.model.information;

import com.fasterxml.jackson.annotation.JsonFormat;
import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import net.neptech.utils.SnowflakeIdGenerator;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serial;
import java.io.Serializable;
import java.util.Date;

/**
 * @Author 谢辉
 * @Date 2025/8/20 19:00
 * @Description 健康科普文章实体类
 **/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table(name = "infor_article")
public class InforArticle implements Serializable {

    @Serial
    private static final Long serialVersionUID = 1L;

    @Id
    @GenericGenerator(name = "snowflake", type = SnowflakeIdGenerator.class)
    @GeneratedValue(generator = "snowflake")
    @Column(name = "article_id", nullable = false)
    private Long articleId; // 健康科普文章ID

    @Column(name = "article_title")
    private String articleTitle; // 健康科普文章标题

    @Column(name = "article_content",columnDefinition = "TEXT")
    private String articleContent; // 健康科普文章内容

    @Column(name = "article_img")
    private String articleImg; // 健康科普文章图片

    @Column(name = "status")
    private Integer status = 1; // 健康科普文章状态(0-无效,1-有效)

    @Column(name = "publish_time")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date publishTime; // 发布时间

    @Column(name = "create_time")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime; // 创建时间

    @Column(name = "update_time")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updateTime; // 更新时间
}
